//检验x在一定精度下是否为ax=b的解

#include <iostream>
#include <cmath>//sqrt
#include <limits>//numeric
using namespace std;

int main(int argc, char *argv[])
{
    int n = 0;
    cin >> n;
    const double eps = numeric_limits<double>::epsilon();//标准库函数，返回最小正浮点数
    double A[n][n];
    double b[n];
    double x[n];
    double residual = 0.0;
    
    for (int i = 0; i < n; i++)
	for (int j = 0; j < n; j++)
	    cin >> A[i][j];
    for (int i = 0; i < n; i++)
	cin >> b[i];

    for (int i = 0; i < n; i++)
	cin >> x[i];

    /// Compute the residual with l2-norm.
    for (int i = 0; i < n; i++)
    {
	double ei = 0.0;
	for (int j = 0; j < n; j++)
	    ei += A[i][j] * x[j];
	ei -= b[i];
	residual += ei * ei;
    }
    residual = sqrt(residual);

    cout << residual << endl;

    if (residual < eps * n * n)//复杂度n2,sqrt是2范数
	cout << "Passed." << endl;
    else
	cout << "Failed." << endl;

    return 0;
}
